package net.zoneland.geological.sms.controller;

import net.zoneland.geological.project.controller.Tbl_projectController;
import net.zoneland.geological.sms.SendMessage;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by cmcc on 2016/12/10.
 */
@Controller
@RequestMapping("sms")
public class SMSController {

	private static Logger logger = Logger.getLogger(SMSController.class);

    @RequestMapping(value = "/send")
    @ResponseBody
    private Map<String, Object> saveProject(String mobile, String message) {

    	Map<String, Object> result = new HashMap<>();
    	
        try {
        	logger.info("发送短信：" + mobile + "==" + message);
            SendMessage.doIt(mobile, message);
            result.put("message", "发送成功");
        } catch (Exception e) {
            e.printStackTrace();
            result.put("message", "发送失败");
        }

        return result;
    }
}
